const { join } = require('path');
function resolve(path) {
  return join(__dirname, path);
}

/**
 * @type {import('electron-builder').Configuration}
 * @see https://www.electron.build/configuration/configuration
 */
const config = {
  productName: 'app',
  directories: {
    output: resolve('dist')
  },
  electronDownload: {
    mirror: 'https://npmmirror.com/mirrors/electron/'
  },
  files: [
    resolve('packages/backend/package.json'),
    {
      from: resolve('packages/backend/dist'),
      to: 'backend'
    },
    {
      from: resolve('packages/frontend/dist'),
      to: 'frontend'
    }
  ],
  electronLanguages: ['en-US', 'zh-CN'],
  extraResources: [
    {
      from: resolve('packages/backend/.env'),
      to: '.env'
    },
    {
      from: resolve('packages/backend/db'),
      to: 'db'
    }
  ]
};

module.exports = config;
